package JLB_Chapter_04;
// GetArrayLength
public class code_04_01 {
    public static void main(String[] args) {
        // 赋值数组的三种不同方式
        int[] a = { 1,2,3 };
        int[] b = new int[] { 4,5,6 };
        int[] c = new int[3];
        c[0] = 7;
        c[1] = 8;
        c[2] = 9;
        // 利用for-each循环输出数组中的各个元素
        for (int row : a) {
            System.out.print(row + " ");
        }
        System.out.println();
        for (int row : b) {
            System.out.print(row + " ");
        }
        System.out.println();
        for (int row : c) {
            System.out.print(row + " ");
        }
        System.out.println();
        // 定义一个String类型数组
        String[] name = new String[] { "Bob","Andy","jenny","Paul","Stupid" };
        for (String row : name) {
            System.out.print(row + "  ");
        }
        System.out.println();
        // 输出一个一维数组的长度
        char[] exap1 = new char[] { 'A','B','C','D' };
        System.out.println("数组exap1的长度为" + exap1.length);
        char[] exap2 = exap1;
        System.out.println("数组exap2的长度为" + exap2.length);
    }
}